{% extends 'bootstrap/base.html' %}

{% block title %}Restaurants{% endblock %}

{% block content %}

<div class="container">
  <div class="row">
    <div class="col-sm-12">

      <h1>All Cafes</h1>

	  <table class="table table-striped">
          <!-- This is where you will write the code to render a Bootstrap 
          Table that contains all the information from the 
          cafe-data.csv file. -->
        <thead>
            <tr>
            {% for h in cafes.pop(0) %}
            <th>{{ h }}</th>
            {% endfor %}
            </tr>
        </thead>
        <tbody>
            {% for row in cafes %}
            <tr>
            {% for attr in row %}
            <td>
                {% if attr.startswith('http') %}
                <a href="{{ attr }}" target="_blank">{{ attr }}</a>
                {% else %}
                {{ attr }}
                {% endif %}
            </td>
            {% endfor %}
            </tr>
            {% endfor %}
        </tbody>
  	  </table>

      <p><a href="/">Return to index page</a></p>
      <p><a href="{{ url_for('add') }}">Add the cafe</a></p>

    </div>
  </div>
</div>

{% endblock %}
